package com.company.study.dsa.sort;

/**
 * 排序抽象类
 * Created by Anbang713 on 2019/6/17.
 */
public abstract class AbstractSort implements Sortable {

  @Override
  public void display(int[] array) {
    if (array == null || array.length == 0) {
      return;
    }
    for (int i = 0; i < array.length; i++) {
      System.out.print(array[i] + " ");
    }
    System.out.println();
  }

  public void test(int[] array) {
    if (array == null || array.length == 0) {
      return;
    }
    System.out.println("未排序数组顺序为：");
    display(array);
    System.out.println("-----------------------");
    array = sort(array);
    System.out.println("-----------------------");
    System.out.println("排序后的数组顺序为：");
    display(array);
  }
}
